using System;

public class ARPGTestBoarStateBehaviour
{
    public Action<ARPGTestBoarStateBehaviour> onPatrolEnter, onPatrolExit, onPatrolUpdate, onCombatEnter, onCombatExit, onCombatUpdate, onDeadEnter, onDeadExit, onDeadUpdate, onIdleEnter, onIdleExit, onIdleUpdate, onChaseEnter, onChaseExit, onChaseUpdate, onBackEnter, onBackExit, onBackUpdate, onFleeEnter, onFleeExit, onFleeUpdate, onSpecialEnter, onSpecialExit, onSpecialUpdate;
    ARPGTestBoarState state;
    public ARPGTestBoarState State => state;
    public void StateUpdate()
    {
         switch (state)
         {
          case ARPGTestBoarState.Patrol:
               PatrolStateUpdate();
               break;
          case ARPGTestBoarState.Combat:
               CombatStateUpdate();
               break;
          case ARPGTestBoarState.Dead:
               DeadStateUpdate();
               break;
          case ARPGTestBoarState.Idle:
               IdleStateUpdate();
               break;
          case ARPGTestBoarState.Chase:
               ChaseStateUpdate();
               break;
          case ARPGTestBoarState.Back:
               BackStateUpdate();
               break;
          case ARPGTestBoarState.Flee:
               FleeStateUpdate();
               break;
          case ARPGTestBoarState.Special:
               SpecialStateUpdate();
               break;
         }
    }
    public void StateExit()
    {
         switch (state)
         {
          case ARPGTestBoarState.Patrol:
               PatrolStateExit();
               break;
          case ARPGTestBoarState.Combat:
               CombatStateExit();
               break;
          case ARPGTestBoarState.Dead:
               DeadStateExit();
               break;
          case ARPGTestBoarState.Idle:
               IdleStateExit();
               break;
          case ARPGTestBoarState.Chase:
               ChaseStateExit();
               break;
          case ARPGTestBoarState.Back:
               BackStateExit();
               break;
          case ARPGTestBoarState.Flee:
               FleeStateExit();
               break;
          case ARPGTestBoarState.Special:
               SpecialStateExit();
               break;
         }
    }
    public void EnterPatrolState()
    {
        StateExit();
        state = ARPGTestBoarState.Patrol;
        onPatrolEnter?.Invoke(this);
    }

    void PatrolStateExit()
    {
        onPatrolExit?.Invoke(this);
    }

    void PatrolStateUpdate()
    {
        onPatrolUpdate?.Invoke(this);
    }

    public void EnterCombatState()
    {
        StateExit();
        state = ARPGTestBoarState.Combat;
        onCombatEnter?.Invoke(this);
    }

    void CombatStateExit()
    {
        onCombatExit?.Invoke(this);
    }

    void CombatStateUpdate()
    {
        onCombatUpdate?.Invoke(this);
    }

    public void EnterDeadState()
    {
        StateExit();
        state = ARPGTestBoarState.Dead;
        onDeadEnter?.Invoke(this);
    }

    void DeadStateExit()
    {
        onDeadExit?.Invoke(this);
    }

    void DeadStateUpdate()
    {
        onDeadUpdate?.Invoke(this);
    }

    public void EnterIdleState()
    {
        StateExit();
        state = ARPGTestBoarState.Idle;
        onIdleEnter?.Invoke(this);
    }

    void IdleStateExit()
    {
        onIdleExit?.Invoke(this);
    }

    void IdleStateUpdate()
    {
        onIdleUpdate?.Invoke(this);
    }

    public void EnterChaseState()
    {
        StateExit();
        state = ARPGTestBoarState.Chase;
        onChaseEnter?.Invoke(this);
    }

    void ChaseStateExit()
    {
        onChaseExit?.Invoke(this);
    }

    void ChaseStateUpdate()
    {
        onChaseUpdate?.Invoke(this);
    }

    public void EnterBackState()
    {
        StateExit();
        state = ARPGTestBoarState.Back;
        onBackEnter?.Invoke(this);
    }

    void BackStateExit()
    {
        onBackExit?.Invoke(this);
    }

    void BackStateUpdate()
    {
        onBackUpdate?.Invoke(this);
    }

    public void EnterFleeState()
    {
        StateExit();
        state = ARPGTestBoarState.Flee;
        onFleeEnter?.Invoke(this);
    }

    void FleeStateExit()
    {
        onFleeExit?.Invoke(this);
    }

    void FleeStateUpdate()
    {
        onFleeUpdate?.Invoke(this);
    }

    public void EnterSpecialState()
    {
        StateExit();
        state = ARPGTestBoarState.Special;
        onSpecialEnter?.Invoke(this);
    }

    void SpecialStateExit()
    {
        onSpecialExit?.Invoke(this);
    }

    void SpecialStateUpdate()
    {
        onSpecialUpdate?.Invoke(this);
    }

}
